﻿#include <iostream>
#include <string>

#include <zmq.hpp>
#include <spdlog/spdlog.h>

int main()
{
	zmq::context_t ctx;
	zmq::socket_t requester = zmq::socket_t(ctx, ZMQ_REQ);
	requester.connect("tcp://localhost:5555");
	spdlog::info("Connecting to hello world server...");

	while (true) {
		std::string request = { "hello" };
		requester.send(request.data(), request.size());
		spdlog::info("Send request: {}", request);

		zmq::message_t respond;
		requester.recv(&respond);
		std::string respond_str((char*)respond.data(), respond.size());
		spdlog::info("Receve respond: {}", respond_str);
	}
}